using System;
using System.Collections.Generic;
using System.Text;

namespace PaulRz.Util.Patterns
{
    public abstract class ProducerPipelineElement<TOutput> : PipelineElement<NullIOType, TOutput>
        where TOutput : class 
    {
        protected ProducerPipelineElement(string name, ILogInterface logger, int joinTime) : base(name, logger, joinTime)
        {
        }

        protected abstract TOutput ReceiveMessage();
        
        protected override void ProcessCycle()
        {
            TOutput message = ReceiveMessage();
            if (message!=null)
                Output.Enqueue(message);
        }
    }
}
